from dataclasses import dataclass, field, fields


@dataclass
class A:
    bar: int = field(default=1)

    def configure(self):
        for _field in fields(self):
            print(_field.name, getattr(self, _field.name))


a = A()
a.configure()
